package ACEbrickBreaker;

/**
 * <p>
 * Title: Ball
 * </p>
 * <p>
 * Description: Ball Class Contains constructors for the Ball object including
 * position and velocity and getters and setters for both of these attributes
 * </p>
 * 
 * @author Caitlin Finn
 * @email caitlin.finn@my.uwrf.edu
 * @author Erin McNeil
 * @email erin.mcneil@my.uwrf.edu
 * @author Andrew Juranek
 * @email andrew.juranek@my.uwrf.edu
 * @date December 10th 2012
 */
public class Ball {

	// coordinates
	int x, y;

	// velocities
	int dx, dy;

	// Singleton instance
	private static Ball ball = null;

	/**
	 * private alternate constructor
	 * 
	 * @param x
	 * @param y
	 */
	public Ball(int x, int y) {

		this.x = x;
		this.y = y;
		dx = 0;
		dy = 0;

	}

	/**
	 * instantiates instance if there isn't already one
	 * 
	 * @param x
	 * @param y
	 * @return ball
	 */
	public static Ball getBall(int x, int y) {
		if (ball == null) {
			ball = new Ball(x, y);

		}
		return ball;
	}

	/**
	 * gets x velocity of the ball
	 * 
	 * @return dx
	 */
	public int getXVelocity() {
		return dx;
	}

	/**
	 * sets x velocity of ball
	 * 
	 * @param dx
	 */
	public void setXVelocity(int dx) {
		this.dx = dx;
	}

	/**
	 * gets y velocity of ball
	 * 
	 * @return dy
	 */
	public int getYVelocity() {
		return dy;
	}

	/**
	 * sets y velocity of ball
	 * 
	 * @param dy
	 */
	public void setYVelocity(int dy) {
		this.dy = dy;
	}

	/**
	 * gets x-coordinate of ball
	 * 
	 * @return x
	 */
	public int getX() {
		return x;
	}

	/**
	 * sets x-coordinate of ball
	 * 
	 * @param x
	 */
	public void setX(int x) {
		this.x = x;
	}

	/**
	 * gets y-coordinate of ball
	 * 
	 * @return y
	 */
	public int getY() {
		return y;
	}

	/**
	 * sets y-coordinate of ball
	 * 
	 * @param y
	 */
	public void setY(int y) {
		this.y = y;
	}

}
